Skip to content

ci: bind the no-mistakes attestation to the current PR head - #161

Merged
kunchenguid merged 1 commit into
mainfrom
fm/axi-nm-headbind-r1
Aug 21, 2026
Merged

ci: bind the no-mistakes attestation to the current PR head#161
kunchenguid merged 1 commit into
mainfrom
fm/axi-nm-headbind-r1

Conversation

@kunchenguid

Copy link
Copy Markdown
Owner

What Changed

The attestation gate parsed the no-mistakes-pipeline-attestation:v1 payload's
head_sha and printed it, but never compared it to the PR's current head. A
commit pushed directly after a no-mistakes run therefore passed the gate on a
stale attestation that described different code.

This ports the head binding that landed on lavish-axi main (PR #271):

  • PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }} added to the gate
    step's env:.
  • After parsing the payload, the gate fails unless the attestation's head_sha
    is present, the PR head sha is present, and the two are equal. On mismatch it
    emits an ::error:: naming both shas and telling the author to re-run
    git push no-mistakes.
  • Fails closed on an absent head_sha and on an absent PR_HEAD_SHA.

A synchronize event whose PR body was not rewritten by no-mistakes now goes
red. That is the attestation contract, not a false positive.

This repo's paths-ignore, author exemptions, if: condition, and job name are
unchanged. The gate run: script is byte-identical to lavish-axi main's.

Tests

Four regression cases added to test/no-mistakes-gate.test.mjs, mirroring
lavish's and adapted to this repo's describe/it + YAML-parse extraction:
matching head passes, stale head fails, missing head_sha fails closed, missing
PR_HEAD_SHA fails closed.

pnpm run test:workflows
$ node --test test/no-mistakes-gate.test.mjs
▶ no-mistakes PR gate
  ✔ accepts a body whose attestation completes review, test, and document
  ✔ still rejects a body with no no-mistakes signature
  ✔ rejects a signed body with no attestation and names the required version
  ✔ rejects an attestation whose test step is skipped
  ✔ rejects an attestation whose test step is failed
  ✔ rejects an attestation whose test step is running
  ✔ rejects an attestation whose test step is pending
  ✔ rejects an attestation that omits a required step entirely
  ✔ rejects a required step recorded twice unless every record completed
  ✔ rejects a completed step carrying a skip_reason marker
  ✔ rejects a completed step carrying a skipped marker
  ✔ rejects a completed step carrying a agent_unavailable marker
  ✔ rejects a completed step carrying a quota_exhausted marker
  ✔ accepts an attestation whose head_sha is the PR's current head
  ✔ rejects an attestation whose head_sha is not the PR's current head
  ✔ fails closed when the attestation carries no head_sha at all
  ✔ fails closed when the PR head sha is unavailable
  ✔ fails closed on an attestation payload that is not valid JSON
  ✔ fails closed when the payload has no steps array
  ✔ fails closed when the attestation comment is never closed
  ✔ accepts a CRLF body
✔ no-mistakes PR gate (361.099541ms)
ℹ tests 21
ℹ suites 1
ℹ pass 21
ℹ fail 0
ℹ skipped 0
lint / format:check / docs:check
$ eslint packages/axi-sdk-js/src packages/axi-sdk-js/test eslint.config.mjs scripts test
(clean)

$ prettier --check ...
Checking formatting...
All matched files use Prettier code style!

$ node scripts/generate-docs.mjs --check
docs:check ok — generated regions match their sources

Note

This PR was raised directly, not through git push no-mistakes, so the advisory
Require no-mistakes check will fail on it by design. The real checks (build,
test, guard-generated-files) are the ones to read.

@kunchenguid
kunchenguid merged commit 6df2cdc into main Aug 21, 2026
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant